/*
	VerbDamageNoun.cpp
	(c)1999 Palestar, Richard Lyle
*/


#include "Debug/Assert.h"
#include "NounShip.h"
#include "NounPlanet.h"
#include "NounAsteroid.h"
#include "VerbDamageNoun.h"
#include "GameContext.h"

//-------------------------------------------------------------------------------

IMPLEMENT_FACTORY( VerbDamageNoun, Verb );

BEGIN_PROPERTY_LIST( VerbDamageNoun, Verb )
	ADD_TRANSMIT_PROPERTY( m_pFrom );
	ADD_TRANSMIT_PROPERTY( m_Damage );
	ADD_TRANSMIT_PROPERTY( m_Type );
	ADD_TRANSMIT_PROPERTY( m_Direction );
END_PROPERTY_LIST();

VerbDamageNoun::VerbDamageNoun()
{}

VerbDamageNoun::VerbDamageNoun( Noun * pTarget, Noun * pFrom, int damage, byte type, const Vector3 & direction ) 
	: m_pFrom( pFrom ), m_Damage( damage ), m_Type( type ), m_Direction( direction )
{
	attachVerb( pTarget );
}

//----------------------------------------------------------------------------

Verb::Priority VerbDamageNoun::priority() const
{
	return CRITICAL;
}

Verb::Scope VerbDamageNoun::scope() const
{
	return LOCAL;
}

bool VerbDamageNoun::client() const
{
	return false;
}

bool VerbDamageNoun::queue() const
{
	return true;
}

//----------------------------------------------------------------------------

void VerbDamageNoun::onExecute()
{
	NounGame * pTarget = WidgetCast<NounGame>( target() );
	if ( validate( pTarget ) )
		pTarget->inflictDamage( tick(), m_pFrom, m_Damage, m_Type, m_Direction );
}

//----------------------------------------------------------------------------
// EOF
